<!--#
layout("/layouts/platform.html"){
#-->
<div id="app"  v-cloak>
    <!--<div class="head">
        <div class="headone"><i class="el-icon-menu"></i>
            <span>${menuName}</span>
        </div>
    </div>-->
    <el-row class="header navbar bg-white">
        <div class="btn-group tool-button" style="line-height: 50px;">
            样品编号或名称：<el-input placeholder="样品编号或名称" v-trim v-model="pageForm.searchKeyword"  size="mini" style="width:180px;" clearable></el-input>
            <!--#if(@shiro.hasPermission("bus.bggl.tody")&&operation=='dy'){#-->
            打印状态：<el-select v-trim v-model="pageForm.dyzt" placeholder="打印状态" size="mini" style="width:180px;" @change="doSearch" clearable>
                <el-option  label="未打印" value="0"></el-option>
                <el-option  label="已打印" value="1"></el-option>
            </el-select>
            <span v-if="pageForm.dyzt==1">
            打印时间：<el-date-picker type="datetime" placeholder="打印开始时间" v-trim v-model="pageForm.startDate" size="mini" value-format="yyyy-MM-dd HH:mm:ss" style="width: 180px;"></el-date-picker>
            -<el-date-picker type="datetime" placeholder="打印结束时间" v-trim v-model="pageForm.endDate" size="mini" value-format="yyyy-MM-dd HH:mm:ss" style="width: 180px;"></el-date-picker>
                </span>
            <!--#}#-->
            <el-button slot="append" icon="el-icon-search" size="mini" @click="doSearch" circle></el-button>
        </div>
    </el-row>
    <el-row class="el-table-container">
        <el-table :data="tableData" @sort-change='pageOrder' row-key="id" height="520"  border size="small" header-align="center"  style="width: 100%" @selection-change="handleSelectionChange">
            <el-table-column fixed="left" prop="userOnline" label="操作" width="80" header-align="center" align="center">
                <template slot-scope="scope">
                    <el-dropdown @command="dropdownCommand">
                        <el-button size="mini"><i class="ti-settings"></i><span class="ti-angle-down"></span></el-button>
                        <el-dropdown-menu slot="dropdown">
                            <!--#if(@shiro.hasPermission("bus.bggl.tobz")&&operation=='bz'){#-->
                                <el-dropdown-item divided :command="{type:'tobz',obj:scope.row}">编制</el-dropdown-item>
                            <!--#}#-->
                            <!--#if(@shiro.hasPermission("bus.bggl.tosh")&&operation=='sh'){#-->
                                <el-dropdown-item divided :command="{type:'tosh',obj:scope.row}">审核</el-dropdown-item>
                            <!--#}#-->
                            <!--#if(@shiro.hasPermission("bus.bggl.topz")&&operation=='pz'){#-->
                                <el-dropdown-item divided :command="{type:'topz',obj:scope.row}">批准</el-dropdown-item>
                            <!--#}#-->
                            <!--#if(@shiro.hasPermission("bus.bggl.tojs")&&operation=='js'){#-->
                                <el-dropdown-item divided :command="{type:'tojs',obj:scope.row}">解锁</el-dropdown-item>
                            <!--#}#-->
                            <!--#if(@shiro.hasPermission("bus.bggl.toyq")&&operation=='yq'){#-->
                                <el-dropdown-item divided :command="{type:'toyq',obj:scope.row}">延期</el-dropdown-item>
                            <!--#}#-->
                            <!--#if(@shiro.hasPermission("bus.bggl.tody")&&operation=='dy'){#-->
                                <el-dropdown-item divided :command="{type:'tody',obj:scope.row}">打印</el-dropdown-item>
                            <!--#}#-->
                            <el-dropdown-item  :command="{type:'detail',obj:scope.row}">详情</el-dropdown-item>
                            <template v-if="scope.row.lczt>4">
                                <el-dropdown-item :command="{type:'openReport',obj:scope.row}">报告</el-dropdown-item>
                            </template>
                        </el-dropdown-menu>
                    </el-dropdown>
                </template>
            </el-table-column>
            <el-table-column fixed="left" prop="lczt" label="检验状态" width="80px;" header-align="center"  show-overflow-tooltip>
                <template slot-scope="scope" ><span :class="'statusCss-'+scope.row.lczt"><i :class="'el-icon-'+scope.row.lczt"/>{{getDict(scope.row.lczt,allMap.lcztMap)}}</span></template>
            </el-table-column>
            <!--#if(@shiro.hasPermission("bus.bggl.tody")&&operation=='dy'){#-->
            <!--<el-table-column fixed="left" prop="dyzt" label="打印状态" width="80px;" header-align="center"  show-overflow-tooltip>
                <template slot-scope="scope" >
                    <template v-if="scope.row.dyzt==1">
                        已打印
                    </template>
                    <template v-else>
                        未打印
                    </template>
                </template>
            </el-table-column>-->
            <!--#}#-->
            <el-table-column fixed="left" sortable="custom" prop="ypbh" label="样品编号" width="120px;" header-align="center" show-overflow-tooltip></el-table-column>
            <el-table-column fixed="left" sortable="custom" prop="bgbh" label="报告编号" width="150px;" header-align="center" show-overflow-tooltip></el-table-column>
            <el-table-column v-if="operation=='sh'||operation=='pz'" prop="bgtjsj" label="提交时间" width="150px;" header-align="center" show-overflow-tooltip></el-table-column>
            <el-table-column v-if="operation=='js'|| operation=='dy'" prop="pzsj" label="批准时间" width="150px;" header-align="center" show-overflow-tooltip></el-table-column>
            <el-table-column v-if="operation=='yq'" prop="czsj" label="最新操作时间" width="150px;" header-align="center" show-overflow-tooltip></el-table-column>
            <el-table-column v-if="operation=='dy' " prop="dysj" label="打印时间" width="150px;" header-align="center" show-overflow-tooltip></el-table-column>
            <el-table-column v-if="operation!='bz'" prop="nextspr" label="编制人" width="100px;" header-align="center" show-overflow-tooltip></el-table-column>
            <el-table-column sortable="custom"  prop="ypmc" label="产品名称" min-width="150px;" header-align="center" show-overflow-tooltip></el-table-column>
            <el-table-column sortable="custom" prop="jylx" label="检验类别" width="100px;" header-align="center" align="center" show-overflow-tooltip>
                <template slot-scope="scope" >{{getDict(scope.row.jylx,allMap.jylxMap)}}</template>
            </el-table-column>
            <el-table-column sortable="custom" prop="jyks" label="检验部门" width="100px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column prop="wtdw" label="委托单位" min-width="180px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column sortable="custom" prop="wcqx" label="完成期限" width="100px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column prop="" label="剩余时间" min-width="100px;" header-align="center" align="center" show-overflow-tooltip>
                <template slot-scope="scope" ><span  v-html="getDay(scope.row,scope.$index)"></span></template></el-table-column>
            <!--<el-table-column prop="ggxh" label="规格型号" width="100px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column prop="scrqpc" label="原编号/生产日期" width="120px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column prop="sb" label="商标" width="100px;" header-align="center" align="center" show-overflow-tooltip></el-table-column>-->
        </el-table>
    </el-row>
    <el-row class="el-pagination-container">
        <el-pagination @size-change="pageSizeChange" @current-change="pageNumberChange" :current-page="pageForm.pageNumber" :page-sizes="[10, 20, 30, 50]"
                :page-size="pageForm.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="pageForm.totalCount">
        </el-pagination>
    </el-row>
    </el-dialog>
    <div>
    <el-drawer :title="deltailName" :visible.sync="drawer" ref="drawerRef" direction="rtl" size="80%" @opened="openIframe" destroy-on-close>
        <!--#if(@shiro.hasPermission("bus.bggl.tody")&&operation=='dy'){#-->
            <div style="text-align: left;margin-left: 20px;" v-if="showPrintDo">
            <el-button type="primary" @click="printDo" plain size="mini">标记打印完成</el-button>
            </div>
        <!--#}#-->
        <iframe id="iframeDetail"  src="" width="100%" height="100%" frameborder="0" marginheight="0" ></iframe>
    </el-drawer>
    </div>
    <el-dialog :close-on-click-modal="false" title="报告审核" :visible.sync="shDialogVisible" width="40%">
        <el-form :model="formData" ref="shForm" :rules="Rules"  size="mini" label-width="100px" >
            <el-form-item prop="ypbh" label="样品编号">
                {{formData.ypbh}}&nbsp;&nbsp;&nbsp;&nbsp;
                <el-link type="primary" size="mini" @click="dropdownCommand({type:'detail',obj:formData})">详情查看</el-link>&nbsp;&nbsp;&nbsp;&nbsp;
                <el-link type="success" size="mini" @click="dropdownCommand({type:'openReport',obj:formData})">报告查看</el-link>
            </el-form-item>
            <el-form-item prop="lczt" label="审批状态">
                <el-radio-group v-model="formData.lczt" size="mini">
                    <el-radio label="7" border>提交批准</el-radio>
                    <el-radio label="6" border>退回编制</el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item prop="spyj" label="意见">
                <!--<el-input maxlength="200"  v-trim v-model="formData.spyj" type="textarea" size="mini" rows="3"></el-input>-->
                <el-autocomplete
                        v-trim v-model="formData.spyj"
                        :fetch-suggestions="termSearch"
                        value-key="content"
                        clearable
                        placeholder="请输入审核意见"
                        type="textarea"
                        style="width:100%;"
                        rows="3"
                        maxlength="255"
                />

            </el-form-item>
            <el-form-item prop="nextsprIds" label="批准人" v-if="formData.lczt==7">
                <el-cascader v-model="formData.nextsprIds" :options="allMap.userOptions"  ref="nextsprCascader"  filterable style="width:100%;"></el-cascader>
            </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer"><el-button @click="shDialogVisible = false">取 消</el-button><el-button type="primary" @click="examineDo">提 交</el-button></span>
    </el-dialog>
    <el-dialog :close-on-click-modal="false" title="报告批准" :visible.sync="pzDialogVisible" width="40%">
        <el-form :model="formData" ref="pzForm" :rules="Rules"  size="mini" label-width="100px" >
            <el-form-item prop="ypbh" label="样品编号">
                {{formData.ypbh}}&nbsp;&nbsp;&nbsp;&nbsp;
                <el-link type="primary" size="mini" @click="dropdownCommand({type:'detail',obj:formData})">详情查看</el-link>&nbsp;&nbsp;&nbsp;&nbsp;
                <el-link type="success" size="mini" @click="dropdownCommand({type:'openReport',obj:formData})">报告查看</el-link>
            </el-form-item>
            <el-form-item prop="lczt" label="审批状态">
                <el-radio-group v-model="formData.lczt" size="mini">
                    <el-radio label="9" border>批准通过</el-radio>
                    <el-radio label="8" border>退回编制</el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item prop="spyj" label="意见">
                <el-autocomplete
                        v-trim v-model="formData.spyj"
                        :fetch-suggestions="termSearch"
                        value-key="content"
                        clearable
                        placeholder="请输入审核意见"
                        type="textarea"
                        style="width:100%;"
                        rows="3"
                        maxlength="255"
                />
            </el-form-item>
            <!--<el-form-item prop="nextsprIds" label="接收人">
                <el-cascader v-model="formData.nextsprIds" :options="allMap.userOptions" :props="{ multiple: true }" ref="nextsprCascader"   style="width:100%;"></el-cascader>
            </el-form-item>-->
        </el-form>
        <span slot="footer" class="dialog-footer"><el-button @click="pzDialogVisible = false">取 消</el-button><el-button type="primary" @click="approvalDo">提 交</el-button></span>
    </el-dialog>
    <el-dialog :close-on-click-modal="false" title="报告解锁" :visible.sync="jsDialogVisible" width="40%">
        <el-form :model="formData" ref="jsForm"  size="mini" label-width="100px" >
            <el-form-item prop="ypbh" label="样品编号">
                {{formData.ypbh}}&nbsp;&nbsp;&nbsp;&nbsp;
                <el-link type="primary" size="mini" @click="dropdownCommand({type:'detail',obj:formData})">详情查看</el-link>&nbsp;&nbsp;&nbsp;&nbsp;
                <el-link type="success" size="mini" @click="dropdownCommand({type:'openReport',obj:formData})">报告查看</el-link>
            </el-form-item>
            <el-form-item prop="spyj" label="意见">
                <el-autocomplete
                        v-trim v-model="formData.spyj"
                        :fetch-suggestions="termSearch"
                        value-key="content"
                        clearable
                        placeholder="请输入审核意见"
                        type="textarea"
                        style="width:100%;"
                        rows="3"
                        maxlength="255"
                />
            </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer"><el-button @click="jsDialogVisible = false">取 消</el-button><el-button type="primary" @click="unlockDo">提 交</el-button></span>
    </el-dialog>
    <el-dialog :close-on-click-modal="false" title="报告延期" :visible.sync="yqDialogVisible" width="40%">
        <el-form :model="formData" ref="yqForm"  size="mini" label-width="100px" >
            <el-form-item prop="ypbh" label="样品编号">
                {{formData.ypbh}}&nbsp;&nbsp;&nbsp;&nbsp;
                <el-link type="primary" size="mini" @click="dropdownCommand({type:'detail',obj:formData})">详情查看</el-link>&nbsp;&nbsp;&nbsp;&nbsp;
                <el-link type="success" size="mini" @click="dropdownCommand({type:'openReport',obj:formData})">报告查看</el-link>
            </el-form-item>
            <el-form-item prop="yqrq" label="延期日期">
                <el-date-picker type="date"  v-trim v-model="formData.yqrq" value-format="yyyy-MM-dd" style="width: 180px;"></el-date-picker>
            </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer"><el-button @click="yqDialogVisible = false">取 消</el-button><el-button type="primary" @click="delayDo">提 交</el-button></span>
    </el-dialog>
</div>
<script>
    new Vue({
        el: "#app",
        data: function () {
            var allMap = {jylxMap:${jylxMap},lcztMap:${lcztMap},userOptions:${userOptions}};
            return {
                allMap:allMap,
                tableData: [],
                menuOptions: [],
                pageForm: {
                    lczt:'${lczt}',
                    operation:'${operation}',
            <!--#if(@shiro.hasPermission("bus.bggl.tody")&&operation=='dy'){#-->
                    dyzt:"0",
            <!--#}#-->
                },
                multipleSelection: [],
                operation:'${operation}',
                drawer: false,
                deltailName:"",
                deltailURL:"",
                shDialogVisible:false,
                pzDialogVisible:false,
                jsDialogVisible:false,
                yqDialogVisible:false,
                formData:{},
                Rules:{
                    lczt:[{required: true, message: '请选择审批状态！', trigger: ['blur', 'change']}],
                    spyj:[{required: true, message: '审批意见不可为空！', trigger: ['blur', 'change']}],
                    nextsprIds:[{required: true, message: '批准人不可为空！', trigger: ['blur', 'change']}],
                },
                showPrintDo:false,
            }
        },
        methods: {
            pageOrder: function (column) {//按字段排序
                this.pageForm.pageOrderName = column.prop;
                this.pageForm.pageOrderBy = column.order;
                this.pageData();
            },
            pageNumberChange: function (val) {//页码更新操作
                this.pageForm.pageNumber = val;
                this.pageData();
            },
            pageSizeChange: function (val) {//分页大小更新操作
                this.pageForm.pageSize = val;
                this.pageData();
            },
            pageData: function () {//加载分页数据
                var self = this;
                sublime.showLoadingbar();//显示loading
                $.post(base + "/platform/bus/bggl/data", self.pageForm, function (data) {
                    sublime.closeLoadingbar();//关闭loading
                    if (data.code == 0) {
                        self.tableData = data.data.list;
                        self.pageForm.totalCount = data.data.totalCount;
                    } else {
                        self.$message({
                            message: data.msg,
                            type: 'error'
                        });
                    }
                }, "json");
            },
            doSearch: function () {
                this.pageForm.pageNumber = 1;
                this.pageData();
            },
            getDict: function (val, map) {
                if (val != null && val != undefined && val != "" && map != null && map != undefined) {
                    var str = val.split(",");
                    var strname = "";
                    for (var a = 0; a < str.length; a++) {
                        strname += map[str[a]];
                        if (strname == null) {
                            alert(1)
                        }
                        if (a < (str.length - 1)) {
                            strname += "/";
                        }
                    }
                    return strname;
                }
                return "";
            },
            dropdownCommand: function (command) {
                var self = this;
                if ("tobz" == command.type) {
                    window.location.href = "/platform/bus/bggl/organization/" + command.obj.id;
                }
                if ("tosh" == command.type) {
                    self.shDialogVisible = true;
                    self.formData = {spyj: '', lczt: '7'};
                    self.formData.id = command.obj.id;
                    self.formData.ypbh = command.obj.ypbh;
                    self.formData.bgbh = command.obj.bgbh;
                }
                if ("topz" == command.type) {
                    self.pzDialogVisible = true;
                    self.formData = {spyj: '', lczt: '9'};
                    self.formData.id = command.obj.id;
                    self.formData.ypbh = command.obj.ypbh;
                    self.formData.bgbh = command.obj.bgbh;
                }
                if ("tojs" == command.type) {
                    self.jsDialogVisible = true;
                    self.formData ={};
                    self.formData.id = command.obj.id;
                    self.formData.ypbh = command.obj.ypbh;
                    self.formData.bgbh = command.obj.bgbh;
                }
                if ("toyq" == command.type) {
                    self.yqDialogVisible = true;
                    self.formData ={};
                    self.formData.id = command.obj.id;
                    self.formData.ypbh = command.obj.ypbh;
                    self.formData.bgbh = command.obj.bgbh;
                }
                if ("tody" == command.type) {
                    self.formData ={};
                    self.formData.id = command.obj.id;
                    self.drawer = true;
                    self.showPrintDo=true;
                    self.deltailName = "打印报告" + command.obj.bgbh;
                    var WOPISrc = "${AppDomain!}/platform/wopi/files/" + command.obj.id + ".docx";
                    //self.deltailURL="${AppOfficeDomain!}/wv/WordViewer/request.pdf?type=printpdf&WOPISrc="+WOPISrc+"&_="+Math.floor(Math.random()*100000);
                    self.deltailURL = "${AppOfficeDomain!}/wv/WordViewer/request.pdf?type=printpdf&WOPISrc=" + WOPISrc + "&_=" + Math.floor(Math.random() * 100000);
                    //PdfMode=1 开启打印按钮
                }
                if ("detail" == command.type) {
                    self.drawer = true;
                    self.deltailName = "详情";
                    self.showPrintDo=false;
                    self.deltailURL = "/platform/bus/ypxx/jbxx/detail/" + command.obj.id;
                }
                if ("openReport" == command.type) {
                    self.drawer = true;
                    self.deltailName = "查看报告" + command.obj.bgbh;
                    var WOPISrc = "${AppDomain!}/platform/wopi/files/" + command.obj.id + ".docx";
                    //this.wordURL="${AppOfficeDomain!}/wv/wordviewerframe.aspx?WOPISrc="+WOPISrc;
                    //self.deltailURL="${AppOfficeDomain!}/wv/WordViewer/request.pdf?type=printpdf&WOPISrc="+WOPISrc+"&_="+Math.floor(Math.random()*100000);
                    self.deltailURL = "${AppOfficeDomain!}/wv/wordviewerframe.aspx?wdAccPdf=1&WOPISrc=" + WOPISrc + "&_=" + Math.floor(Math.random() * 100000);
                }
            },
            examineDo: function () {
                var self = this;
                self.$refs["shForm"].validate(function (valid) {
                    if (valid) {
                        if (nONull(self.formData.nextsprIds)) {
                            self.formData.nextsprIds = self.formData.nextsprIds.join(",");
                            self.formData.nextspr = self.$refs['nextsprCascader'].getCheckedNodes()[0].label;
                        } else {
                            if (self.formData.lczt == "7") {
                                self.$message({message: '请选择批准人', type: 'warning'});
                                return;
                            }
                        }
                        //补充流程信息
                        self.formData.jbxxId = self.formData.id;
                        sublime.showLoadingbar();//显示loading
                        $.post(base + "/platform/bus/bggl/examineDo", self.formData, function (data) {
                            sublime.closeLoadingbar();//关闭loading
                            if (data.code == 0) {
                                self.$message({
                                    message: data.msg,
                                    type: 'success'
                                });
                                self.shDialogVisible = false;
                                self.doSearch();//查询是带条件的,加载新建用户选择的数据
                            } else {
                                self.$message({
                                    message: data.msg,
                                    type: 'error'
                                });
                            }
                            if (self.formData.lczt == "7") {
                                self.formData.nextsprIds = self.formData.nextsprIds.split(",");
                            }
                        }, "json");
                    }
                });
            },
            approvalDo: function () {
                var self = this;
                self.$refs["pzForm"].validate(function (valid) {
                    if (valid) {
                        /*if (nONull(self.formData.nextsprIds)) {
                            self.formData.nextsprIds = self.formData.nextsprIds.join(",");
                            self.formData.nextspr = self.$refs['nextsprCascader'].getCheckedNodes()[0].label;
                        } else {
                            if(self.formData.lczt=="9"){
                                self.$message({message: '请选择接收人', type: 'warning'});
                                return;
                            }
                        }*/
                        //补充流程信息
                        self.formData.jbxxId = self.formData.id;
                        sublime.showLoadingbar();//显示loading
                        $.post(base + "/platform/bus/bggl/approvalDo", self.formData, function (data) {
                            sublime.closeLoadingbar();//关闭loading
                            if (data.code == 0) {
                                self.$message({
                                    message: data.msg,
                                    type: 'success'
                                });
                                self.pzDialogVisible = false;
                                self.doSearch();//查询是带条件的,加载新建用户选择的数据
                            } else {
                                self.$message({
                                    message: data.msg,
                                    type: 'error'
                                });
                            }
                            /*if(self.formData.lczt=="9") {
                                self.formData.nextsprIds = self.formData.nextsprIds.split(",");
                            }*/
                        }, "json");
                    }
                });
            },
            unlockDo: function () {
                var self = this;
                //补充流程信息
                self.formData.jbxxId = self.formData.id;
                self.formData.lczt = "12";
                self.formData.dyzt = "0";
                sublime.showLoadingbar();//显示loading
                $.post(base + "/platform/bus/bggl/unlockDo", self.formData, function (data) {
                    sublime.closeLoadingbar();//关闭loading
                    if (data.code == 0) {
                        self.$message({
                            message: data.msg,
                            type: 'success'
                        });
                        self.jsDialogVisible = false;
                        self.doSearch();//查询是带条件的,加载新建用户选择的数据
                    } else {
                        self.$message({
                            message: data.msg,
                            type: 'error'
                        });
                    }
                }, "json");
            },
            delayDo: function () {
                var self = this;
                sublime.showLoadingbar();//显示loading
                $.post(base + "/platform/bus/bggl/delayDo", self.formData, function (data) {
                    sublime.closeLoadingbar();//关闭loading
                    if (data.code == 0) {
                        self.$message({
                            message: data.msg,
                            type: 'success'
                        });
                        self.yqDialogVisible = false;
                        self.doSearch();//查询是带条件的,加载新建用户选择的数据
                    } else {
                        self.$message({
                            message: data.msg,
                            type: 'error'
                        });
                    }
                }, "json");
            },
            printDo:function(){
                var self = this;
                sublime.showLoadingbar();//显示loading
                $.post(base + "/platform/bus/bggl/printDo", self.formData, function (data) {
                    sublime.closeLoadingbar();//关闭loading
                    if (data.code == 0) {
                        self.$message({
                            message: data.msg,
                            type: 'success'
                        });
                        //self.drawer = false;这样用有bug，不知道为什么
                        self.$refs.drawerRef.closeDrawer();
                        self.doSearch();//查询是带条件的,加载新建用户选择的数据
                    } else {
                        self.$message({
                            message: data.msg,
                            type: 'error'
                        });
                    }
                }, "json");
            },
            openIframe:function(){
                $("#iframeDetail").attr("src",this.deltailURL);
            },
            handleClose: function() {
                this.drawer=false;
            },
            handleSelectionChange: function (val) {
                this.multipleSelection = val;
            },
            termSearch(val, cb){
                var company = [];
                var searchForm ={
                    name:val
                }
                $.post(base + "/platform/bus/term/list", searchForm, function (data) {
                    if (data.code == 0) {
                        company= data.data;
                        //return company;
                        cb(company)
                    } else {
                        self.$message({
                            message: data.msg,
                            type: 'error'
                        });
                    }
                }, "json");
            },
            getDay(row,index){
                if(row.wcqx){
                    if(row.pzsj){
                        const today = new Date(row.pzsj);
                        const inputDate = new Date(row.wcqx);
                        const diffTime = inputDate-today;
                        const diffDays = Math.abs((diffTime / (1000 * 60 * 60 * 24)).toFixed(0));
                        if(diffTime<0&&diffDays>0){
                            $("#foot"+index).css("color","red");
                            return "<span id='foot"+index+"'>逾期："+diffDays+"天"+"，批准时间："+row.pzsj+"</span>";
                        }else{
                            return "<span id='foot"+index+"'>未逾期，批准时间："+row.pzsj+"</span>";
                        }
                    }else{
                        const today = new Date();
                        const inputDate = new Date(row.wcqx);
                        const diffTime = inputDate-today;
                        const diffDays = Math.abs((diffTime / (1000 * 60 * 60 * 24)).toFixed(0));
                        if(diffTime<0&&diffDays>0){
                            $("#foot"+index).css("color","red");
                            return "<span id='foot"+index+"'>逾期："+diffDays+"天"+"</span>";
                        }else{
                            return "<span id='foot"+index+"'>剩余："+diffDays+"天"+"</span>";
                        }
                    }
                }else{
                    return "";
                }
            }
        },
        created: function () {
            this.doSearch();
        }
    });

    function nONull(val){
        if (val!= null && val!=undefined &&val!="" &&val!="null" &&val!="undefined" ){
            return true;
        }else{
            return false;
        }
    }
</script>
<style>
    .el-autocomplete-suggestion{
        transform-origin: center top;
        z-index: 2015;
        position: fixed;
    }
    /*.el-autocomplete-suggestion li{
        white-space:normal;
        line-height:15px;
        font-size:11px;
    }*/
</style>
<!--#
}
#-->
